<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="layout :: common_header(~{::title})">
    <title>直播间数据管理 - 直播中控台</title>

</head>
<body th:replace="layout :: common_body(~{::div.layui-body})">
<div class="layui-body" style="padding:15px;">
    <div class="layui-tab layui-tab-brief" lay-filter="demo">
        <ul class="layui-tab-title">
            <li class="layui-this"> <a href="/zbj/live_data_list">直播间数据管理</a></li>
            <li> <a href="/zbj/sales_statistics_douyin">直播间销售统计</a></li>
            <li> <a href="/report/goods_sales_analyse">商品动销分析</a></li>
            <li> <a href="/report/goods_category_analyse">商品类目动销分析</a></li>
            <li> <a href="/zbj/sample_list">直播间样品管理</a></li>
            
        </ul>
    </div>
    <style>
        .hideAddress{
            width: 300px;
            display: inline-block;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .dd-table img{
            width: 70px;
            height: 70px;
        }
    </style>
    <!-- content starts -->
    <!--    <blockquote class="layui-elem-quote">订单总览</blockquote>-->

    <fieldset class="layui-elem-field">
        <legend>按条件搜索</legend>
        <div class="layui-field-box">
            <form class="layui-form layui-form-pane1" method="get" th:action="@{/zbj/live_data_list}">
                <input type="hidden" name="pageSize" th:value="${pageSize}">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <input type="text" name="zhiboDate"   placeholder="日期"  autocomplete="off" class="layui-input" id="startTime">
                    </div>
                    <div class="layui-inline">
                        <input type="text" name="authorAccount"   placeholder="主播账号" th:value="${authorAccount}"  class="layui-input" >

                    </div>
                    <div class="layui-inline">
                        <button type="submit" class="layui-btn">搜索</button>
                        <i>总共：<span style="color: red" th:text="${totalSize}"></span>条记录</i>
                    </div>

                    <div class="layui-inline">
                        <a class="layui-btn layui-btn layui-btn-primary"  href="/zbj/live_data_import">直播间数据导入</a>
<!--                        <a class="layui-btn layui-btn layui-btn-primary"  href="/zhibo/edit_zhibo">添加直播</a>-->
<!--                        <a class="layui-btn layui-btn layui-btn-primary" id="goodCopy"  href="javascript:;">商品同步</a>-->
                    </div>
                </div>

            </form>
        </div>
    </fieldset>

    <!-- start dd-wrapper -->
    <link rel="stylesheet" href="/css/order_list.css"/>
    <div class="dd-wrapper">
        <table class="dd-table" id="table1">
            <tr id="tr1">
                <th>ID <a href="javascript:;" style="color: #1E9FFF;font-size:10ps" class="hid">隐藏</a></th>
                <th>直播日期</th>
                <th>开播时间<a href="javascript:;" style="color: #1E9FFF;font-size:10ps" class="hid">隐藏</a></th>
                <th>直播账号</th>
                <th>直播时长（分）</th>
                <th>累计观看</th>
                <th>曝光量</th>
                <th>最高在线</th>
                <th>平均在线</th>
                <th>人均观看时长(分钟)</th>
                <th>评论数</th>
                <th>看播粉丝占比(老粉)</th>
                <th>看播成交转化率</th>
                <th>成交订单数</th>
                <th>成交订单金额</th>
                <th>成交人数<a href="javascript:;" style="color: #1E9FFF;font-size:10ps" class="hid">隐藏</a></th>

                <th>退款订单数<a href="javascript:;" style="color: #1E9FFF;font-size:10ps" class="hid">隐藏</a></th>
                <th>退款金额<a href="javascript:;" style="color: #1E9FFF;font-size:10ps" class="hid">隐藏</a></th>
                <th>营销费用</th>

                <th>操作</th>
            </tr>
            <tr th:each="item:${lists}">
                <td th:text="${item.getId()}"></td>
                <td >
                    <span th:text="${item.getLiveDate()}"></span>
                </td>

                <td >
                    <span th:text="${item.getLiveStartTime()}"></span>
                </td>
                <td >
                    <img  th:src="${item.getAuthorImg()}" style="width: 20px;height: 20px">
                    <span th:text="${item.getAuthorName()}">华衣服饰（蓝V号）</span><br />
                    <span th:text="${item.getAuthorAccount()}">依依（达人号）</span>
                </td>
                <td >
                    <span th:text="${item.getLiveTime()}"></span>&nbsp;
                </td>
                <td >
                    <span th:text="${item.getPV()}"></span>&nbsp;
                </td>
                <td ><span th:text="${item.getShowPV()}"></span>&nbsp;</td>
                <td ><span th:text="${item.getPCU()}"></span>&nbsp;</td>
                <td ><span th:text="${item.getACU()}"></span>&nbsp;</td>
                <td ><span th:text="${item.getTS()}"></span>&nbsp;</td>
                <td ><span th:text="${item.getComments()}"></span></td>
                <td ><span th:text="${#numbers.formatDecimal(item.getKbfszb() * 100 ,1,2)}"></span>%</td>
                <td >
                    <span th:text="${#numbers.formatDecimal(item.getViewTransactionRate() * 100 ,1,2)}"></span>%
                </td>
                <td >
                    <span th:text="${item.getOrderCount()}"></span>
                </td>
                <td ><span th:text="${item.getOrderAmount()}"></span></td>

                <td ><span th:text="${item.getOrderUser()}"></span></td>

                <td ><span th:text="${item.getOrderRefundCount()}"></span></td>
                <td ><span th:text="${item.getOrderRefundAmount()}"></span></td>


                <td >
                    <span th:text="${item.expensesTotal}"></span>
                </td>

                <td>
                    <a class="layui-btn-primary layui-btn-sm edit_expenses" href="javascript:;" th:attr="data-id=${item.getId()}">编辑营销费用</a>
                    <a class="layui-btn-primary layui-btn-sm replay_view" th:attr="data-id=${item.getId()}" href="javascript:;" >查看复盘</a><br/>
                    <a class="delete_live" th:if="${item.getAuthorAccount != 'hyyf000' &&item.getAuthorAccount != 'dfgn00' &&item.getAuthorAccount != 'hyfs0000'&&item.getAuthorAccount != 'hyfz0000'}" th:attr="data-id=${item.getId()}" href="javascript:;" >删除</a>
                </td>
            </tr>
        </table>
    </div>
    <!-- end dd-wrapper -->
    <div class="layui-box layui-laypage layui-laypage-default pageBox">
        <paging:pager th:value="${pageIndex}" th:rows="${totalSize}" th:size="${pageSize}"/>
    </div>

<!--    <script src="/jquery-3.3.1.min.js"></script>-->
<!--    <script type="text/javascript" src="/Tips.js"></script>-->
    <script type="text/javascript">
        var layer;
        var $;
        var windowOpen;

        //计算天数差的函数，通用
        function DateDiff(sDate1, sDate2) { //sDate1和sDate2是2019-3-12格式
            var aDate, oDate1, oDate2, iDays
            aDate = sDate1.split("-")
            oDate1 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]) //转换为9-25-2017格式
            aDate = sDate2.split("-")
            oDate2 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0])
            iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24) //把相差的毫秒数转换为天数
            return iDays
        }

        layui.use(['laydate', 'jquery', 'form', 'layer'], function () {
            var laydate = layui.laydate;
            $ = layui.jquery;
            var form = layui.form;
            layer = layui.layer;
            laydate.render({
                elem: '#startTime'
            });

            form.render();
            $(function () {
                var msg = '[[${msg}]]';
                if(msg !='') layer.msg(msg);

                $(".edit_expenses").click(function () {
                    var id = $(this).attr("data-id");
                    layer.open({
                        type: 2,
                        title: '编辑营销费用',
                        shadeClose: true,
                        shade: 0.8,
                        area: ['500px', '60%'],
                        content: '/zbj/live_marketing_expenses_edit?id=' + id
                    });
                });

                $(".replay_view").click(function () {
                    var id = $(this).attr("data-id");
                    layer.open({
                        type: 2,
                        title: '直播复盘',
                        shadeClose: true,
                        shade: 0.8,
                        area: ['1200px', '80%'],
                        content: '/zbj/live_data_replay?id=' + id
                    });
                });

                $(".delete_live").click(function () {
                    var id = $(this).attr("data-id");
                    var obj = $(this).parent().parent();
                    $.ajax({
                        url: '/zbj/live_data_del?id=' + id,
                        type: "post",
                        success: function (result) {
                            if (result.code == 0) {
                                obj.remove();
                            }
                            return false;
                        },
                        error: function () {
                        },
                        cache: false,
                        contentType: false,
                        processData: false
                    });
                });
            })
        });

        $(function () {
            $(".hid").click(function () {
                var index2 = $("#tr1 th").index($(this).parent());
                var index3 = $(this).parent().index();
                //alert(index2 +':'+ index3);
                $("#table1 tr").each(function () {
                    $(this).children('th').eq(index3).remove();
                    $(this).children('td').eq(index3).remove();
                })
            })
        })

    </script>


</div>
</body>
</html>
